<!DOCTYPE html>
<!-- Inspired by https://github.com/othree/jquery.rtl-scroll-type which is used
     in various JS frameworks to determine what scroll "type" the engine has
     when it comes to RTL. When at the initial scroll position (i.e. all the way
     to the right), some engines sets scrollLeft to 0 and decrement to negative
     values when scrolling leftwards (Gecko). Others set it to 0 and increment
     the value when scrolling leftwards (IE / Edge). Others again set it to the
     width of the scrollable area and decrement it when scrolling leftwards.
     WebKit / Blink used to be the third case, now they are consistent with Gecko.
     There are further complications in the latter engine if
     there's a vertical scrollbar [1], and it's wider than the border box. All
     we need to worry about here though, is that the script is able to detect
     that we are "negative".

     [1] crbug.com/724255 -->
<div id="definer" dir="rtl" style="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll">A</div>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
    test(function() {
        var definer = document.getElementById('definer');
        var type = 'reverse';
        if (definer.scrollLeft > 0) {
            type = 'default';
        }
        else {
            definer.scrollLeft = 1;
            if (definer.scrollLeft === 0) {
                type = 'negative';
            }
        }
        assert_equals(type, 'negative');
    }, "Blink should have 'negative' RTL scroll behavior");
</script>
